package com.yulongtian.oneProblemEveryDay.month202212;

import java.util.HashSet;
import java.util.Iterator;

/**
 * https://leetcode.cn/problems/number-of-different-integers-in-a-string/
 * 可
 *
 * @author yulongTian
 * @create 2022-12-06 9:52
 */
public class Test02 {
    public static void main(String[] args) {
        System.out.println(Integer.MAX_VALUE);
        //2147483647
        //167278959591294
        System.out.println(numDifferentIntegers("167278959591294"));
    }

    public static int numDifferentIntegers(String word) {

        String str = "";

        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) >= 'a' && word.charAt(i) <= 'z') {
                str += " ";
            } else {
                str += word.charAt(i);
            }
        }

        String[] s = str.split(" ");

        HashSet<String> set = new HashSet<>();

        for (String s1 : s) {

            //前导零
            while (s1.startsWith("0") && s1.length() != 1) {
                s1 = s1.substring(1);
            }


            if (!s1.equals(" ") && !s1.equals("")) {
                set.add(s1);
            }
        }
        return set.size();
    }


}
